package com.cpj.bsyyzx.controller;


import com.cpj.bsyyzx.entity.Account;
import com.cpj.bsyyzx.entity.Role;
import com.cpj.bsyyzx.service.IRoleService;
import com.cpj.bsyyzx.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-05-09
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Autowired
    IRoleService roleService;
    @RequestMapping("list")
    CommonResult list(Role role) {
        return CommonResult.success(roleService.list(role));
    }
    @RequestMapping("getOne")
    CommonResult getOne(Integer id){
        return CommonResult.success(roleService.getById(id));
    }

    @RequestMapping("save")
    CommonResult save(Role role){
        return CommonResult.success(roleService.saveOrUpdate(role));
    }

    @RequestMapping("delete")
    CommonResult del(Integer id){
        return CommonResult.success(roleService.removeById(id));
    }
}
